<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:p="http://primefaces.org/ui">
    
  <h:head>
   <title>Fila de espera</title>
  </h:head>
    
  <h:body>
   <h:form>
    <p:outputPanel id="pnlMain">
     <p:panel id="pnlWaiting" header="Fila de Espera"
         rendered="#{BatePapoMB.existeChat}">
    
      <h:outputFormat value="Você é o {0}º da fila de espera.">
       <f:param value="#{BatePapoMB.bo.posicaoUsuario}" />
      </h:outputFormat>
    
      <p:poll update="pnlMain" interval="1"
          rendered="#{not BatePapoMB.existeChat}" />
    
     </p:panel>
    
     <p:outputPanel id="pnlGoChat" rendered="#{BatePapoMB.existeChat}">
      <script type="text/javascript">
       window.open("batePapo.jsf", "_top");
      </script>
     </p:outputPanel>
    
    </p:outputPanel>
   </h:form>
  </h:body>
  </html>